/*
 * @Author: tangyuhui 317972442@qq.com
 * @Date: 2025-09-03 22:18:09
 * @LastEditors: tangyuhui 317972442@qq.com
 * @LastEditTime: 2025-09-10 14:41:05
 */
import { UniversalHttpClient } from "./http-client";
import { ApiUtils } from "./api-utils";
import { createResponseFilter } from "./response-filter";
// 导出类型
export * from "./types";

// 导出主要类
export { UniversalHttpClient } from "./http-client";
export { ApiUtils } from "./api-utils";
export { createResponseFilter } from "./response-filter";
export { logRequestMsg } from "./log.uils";

// 创建便捷的工厂函数
export function createHttpClient(config = {}) {
  return new UniversalHttpClient(config);
}

// 创建便捷的API工具
export function createApiUtils(httpClient: UniversalHttpClient) {
  return new ApiUtils(httpClient);
}

// 默认实例（保持向后兼容）
export const http = new UniversalHttpClient();
export const apiUtils = new ApiUtils(http);

// 便捷的API方法（保持向后兼容）
export const apiGet = apiUtils.get.bind(apiUtils);
export const apiPost = apiUtils.post.bind(apiUtils);
export const apiPut = apiUtils.put.bind(apiUtils);
export const apiDelete = apiUtils.delete.bind(apiUtils);

// 默认响应过滤器
export const httpFilter = createResponseFilter();